Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/map/src/commonMain/kotlin/org/meshtastic/feature/map/node/NodeMapViewModel.kt 1390a3cd4f7bc55a37433d1d868e65c01678eb31 (1390a3cd) Text, 3.61 KB

T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.map.node

Tff7b72import T7ee787androidx.lifecycle.SavedStateHandle
Tff7b72import T7ee787androidx.lifecycle.ViewModel
Tff7b72import T7ee787kotlinx.coroutines.flow.MutableStateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.asFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.combine
Tff7b72import T7ee787kotlinx.coroutines.flow.distinctUntilChanged
Tff7b72import T7ee787kotlinx.coroutines.flow.flatMapLatest
Tff7b72import T7ee787kotlinx.coroutines.flow.map
Tff7b72import T7ee787kotlinx.coroutines.flow.mapLatest
Tff7b72import T7ee787kotlinx.coroutines.flow.toList
Tff7b72import T7ee787org.koin.core.annotation.KoinViewModel
Tff7b72import T7ee787org.meshtastic.core.common.BuildConfigProvider
Tff7b72import T7ee787org.meshtastic.core.model.MeshLog
Tff7b72import T7ee787org.meshtastic.core.repository.MapPrefs
Tff7b72import T7ee787org.meshtastic.core.repository.MeshLogRepository
Tff7b72import T7ee787org.meshtastic.core.repository.NodeRepository
Tff7b72import T7ee787org.meshtastic.core.ui.util.toPosition
Tff7b72import T7ee787org.meshtastic.core.ui.viewmodel.stateInWhileSubscribed
Tff7b72import T7ee787org.meshtastic.proto.PortNum
Tff7b72import T7ee787org.meshtastic.proto.Position

Tf0883e@KoinViewModel
Tff7b72class T56d364NodeMapViewModelTb4b4b4(
Te6edf3savedStateHandleTb4b4b4: Te6edf3SavedStateHandleTb4b4b4,
Te6edf3nodeRepositoryTb4b4b4: Te6edf3NodeRepositoryTb4b4b4,
Te6edf3meshLogRepositoryTb4b4b4: Te6edf3MeshLogRepositoryTb4b4b4,
Te6edf3buildConfigProviderTb4b4b4: Te6edf3BuildConfigProviderTb4b4b4,
Tff7b72private Tff7b72val Te6edf3mapPrefsTb4b4b4: Te6edf3MapPrefsTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3ViewModelTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72private Tff7b72val Te6edf3destNumFromRoute Tff7b72= Te6edf3savedStateHandleTb4b4b4.Te6edf3getTff7b72<Tffa657IntTff7b72>Tb4b4b4(Ta5d6ff"Ta5d6ffdestNumTa5d6ff"Tb4b4b4)
Tff7b72private Tff7b72val Te6edf3manualDestNum Tff7b72= Te6edf3MutableStateFlowTff7b72<Tffa657Int?Tff7b72>Tb4b4b4(Tff7b72nullTb4b4b4)

Tff7b72private Tff7b72val Te6edf3destNumFlow Tff7b72=
Te6edf3combineTb4b4b4(Te6edf3MutableStateFlowTb4b4b4(Te6edf3destNumFromRouteTb4b4b4)Tb4b4b4, Te6edf3manualDestNumTb4b4b4) Tb4b4b4{ Te6edf3routeTb4b4b4, Te6edf3manual Tff7b72-Tff7b72> Te6edf3manual Tff7b72?: Te6edf3route Tff7b72?: T79c0ff0 Tb4b4b4}

Tff7b72fun Td2a8ffsetDestNumTb4b4b4(Te6edf3numTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4{
Te6edf3manualDestNumTb4b4b4.Te6edf3value Tff7b72= Te6edf3num
Tb4b4b4}

Tff7b72val Te6edf3node Tff7b72=
Te6edf3destNumFlow
Tb4b4b4.Te6edf3flatMapLatest Tb4b4b4{ Te6edf3destNum Tff7b72-Tff7b72> Te6edf3nodeRepositoryTb4b4b4.Te6edf3nodeDBbyNumTb4b4b4.Te6edf3mapLatest Tb4b4b4{ Tffa657itTff7b72[Te6edf3destNumTff7b72] Tb4b4b4} Tb4b4b4}
Tb4b4b4.Te6edf3distinctUntilChangedTb4b4b4(Tb4b4b4)
Tb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Tff7b72nullTb4b4b4)

Tff7b72val Te6edf3applicationId Tff7b72= Te6edf3buildConfigProviderTb4b4b4.Te6edf3applicationId

Tff7b72private Tff7b72val Te6edf3ourNodeNumFlow Tff7b72= Te6edf3nodeRepositoryTb4b4b4.Te6edf3myNodeInfoTb4b4b4.Te6edf3map Tb4b4b4{ Tffa657itTff7b72?.Te6edf3myNodeNum Tb4b4b4}Tb4b4b4.Te6edf3distinctUntilChangedTb4b4b4(Tb4b4b4)

Tff7b72val Te6edf3positionLogsTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3ListTff7b72<Te6edf3PositionTff7b72>Tff7b72> Tff7b72=
Te6edf3combineTb4b4b4(Te6edf3ourNodeNumFlowTb4b4b4, Te6edf3destNumFlowTb4b4b4) Tb4b4b4{ Te6edf3ourNodeNumTb4b4b4, Te6edf3destNum Tff7b72-Tff7b72>
Tff7b72if Tb4b4b4(Te6edf3destNum Tff7b72=Tff7b72= Te6edf3ourNodeNumTb4b4b4) Te6edf3MeshLogTb4b4b4.Te6edf3NODE_NUM_LOCAL Tff7b72else Te6edf3destNum
Tb4b4b4}
Tb4b4b4.Te6edf3distinctUntilChangedTb4b4b4(Tb4b4b4)
Tb4b4b4.Te6edf3flatMapLatest Tb4b4b4{ Te6edf3logId Tff7b72-Tff7b72>
Te6edf3meshLogRepositoryTb4b4b4.Te6edf3getMeshPacketsFromTb4b4b4(Te6edf3logIdTb4b4b4, Te6edf3PortNumTb4b4b4.Te6edf3POSITION_APPTb4b4b4.Te6edf3valueTb4b4b4)Tb4b4b4.Te6edf3map Tb4b4b4{ Te6edf3packets Tff7b72-Tff7b72>
Te6edf3packets
Tb4b4b4.Te6edf3mapNotNull Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3toPositionTb4b4b4(Tb4b4b4) Tb4b4b4}
Tb4b4b4.Te6edf3asFlowTb4b4b4(Tb4b4b4)
Tb4b4b4.Te6edf3distinctUntilChanged Tb4b4b4{ Te6edf3oldTb4b4b4, Te6edf3new Tff7b72-Tff7b72>
Te6edf3oldTb4b4b4.Te6edf3time Tff7b72=Tff7b72= Te6edf3newTb4b4b4.Te6edf3time Tff7b72|Tff7b72|
Tb4b4b4(Te6edf3oldTb4b4b4.Te6edf3latitude_i Tff7b72=Tff7b72= Te6edf3newTb4b4b4.Te6edf3latitude_i Tff7b72&Tff7b72& Te6edf3oldTb4b4b4.Te6edf3longitude_i Tff7b72=Tff7b72= Te6edf3newTb4b4b4.Te6edf3longitude_iTb4b4b4)
Tb4b4b4}
Tb4b4b4.Te6edf3toListTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Te6edf3emptyListTb4b4b4(Tb4b4b4)Tb4b4b4)

Tff7b72val Te6edf3mapStyleIdTb4b4b4: Tffa657Int
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3mapPrefsTb4b4b4.Te6edf3mapStyleTb4b4b4.Te6edf3value
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.07s